﻿using Abp.Application.Services.Dto;
using Abp.Application.Services;
using Abp.Domain.Repositories;
using System;
using Choucius.Boilerplate9.WorkStations.Dto;
using System.Collections.Generic;
using System.Linq;

namespace Choucius.Boilerplate9.WorkStations
{
    /// <summary>
    /// 工站
    /// </summary>
    public class WorkStationAppService : AsyncCrudAppService<WorkStation, WorkStationDto, Guid, WorkStationDto, WorkStationDto, WorkStationDto>, IWorkStationAppService
    {
        private readonly IRepository<WorkStation, Guid> _repository;

        /// <summary>
        /// 依赖注入
        /// </summary>
        /// <param name="repository"></param>
        public WorkStationAppService(IRepository<WorkStation, Guid> repository) : base(repository)
        {
            _repository = repository;
        }

        /// <summary>
        /// 获取全部工站ID列表
        /// </summary>
        /// <returns></returns>
        public List<int> GetAllWorkStationIds()
        {
            var result = _repository.GetAllList().Select(entity => entity.WorkStationId).ToList();
            return result;
        }
    }
}
